package com.yinggu.servlet;

import com.yinggu.pojo.KDept;
import com.yinggu.pojo.KUser;
import com.yinggu.service.DeptService;
import com.yinggu.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/userDelete")
public class UserDelete extends HttpServlet {
    UserService service = new UserService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        final String id = req.getParameter("id");
        service.removeUser(Integer.parseInt(id));
        resp.sendRedirect(req.getContextPath()+"/userList");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
